// FEATURE COMPATIBILITY VERSIONS
import { CONSTANTS as GLOBAL_CONSTANTS } from "@requestly/requestly-core";
import FEATURES from "./sub/features";

// set null if the version is never compatiable on appMode
/* for desktop:
  - use string to define the same compatible version for all platforms.
  - use an object if feature is compatible on specific versions for specific platforms
  - omitting platform from the object or setting it's value as null/undefined implies feature is not available for that platform

  keys of the object are case sensitive. refer existing objects or confirm with the ParsedOS enum in osUtils
 */
export const FEATURE_COMPATIBLE_VERSION = {
  [FEATURES.RESPONSE_MAP_LOCAL]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "0.0.29-beta",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.REDIRECT_MAP_LOCAL]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.4.21",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.ASYNC_MODIFY_RESPONSE_BODY]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.SERVE_RESPONSE_WITHOUT_REQUEST]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.4",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.6.5",
  },
  [FEATURES.ASYNC_MODIFY_REQUEST_BODY]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.DESKTOP_APP_TERMINAL_PROXY]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.1.0",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.DESKTOP_APP_SSL_PROXYING]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.EXTENSION_GROUP_PIN_ICON]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "22.0.0",
  },
  [FEATURES.EXTENSION_CONSOLE_LOGGER]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "22.5.8",
  },
  [FEATURES.DESKTOP_USER_PREFERENCES]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.4.19",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.REGENERATE_SSL_CERTS]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.14",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.NETWORK_SESSIONS]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.2",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.API_CLIENT]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.0",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.5.9",
  },
  [FEATURES.SESSION_ONBOARDING]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.7.10",
  },
  [FEATURES.TEST_THIS_RULE]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.8.29",
  },
  [FEATURES.TEST_THIS_RULE_SESSION]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.9.18",
  },
  [FEATURES.GRAPHQL_PAYLOAD_FILTER_OPERATOR]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.6.29",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.10.18",
  },
  [FEATURES.CUSTOM_LAUNCH_OPTIONS]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.12",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.RELAY_AUTH_HEADER]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "23.12.26",
  },
  [FEATURES.DESKTOP_SESSIONS]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.5.17",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.SCRIPT_RULE.ATTRIBUTES_SUPPORT]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "24.2.17",
  },
  [FEATURES.IMPLICIT_TEST_THIS_RULE]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "24.4.18",
  },
  [FEATURES.BLOCK_LIST]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "1.8.1",
      Windows: null,
      Linux: null,
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "24.7.12",
  },
  [FEATURES.DESKTOP_ANDROID_EMULATOR_SUPPORT]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "1.7.0",
      Windows: null,
      Linux: null,
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.SCRIPT_RULE_SOURCE_FILTER]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "24.8.3",
  },
  [FEATURES.CONNECT_EXTENSION]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "1.7.4",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "24.9.17",
  },
  [FEATURES.EDIT_LOCAL_FILE_PATH]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "1.7.6",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },

  [FEATURES.DESKTOP_IOS_SIMULATOR_SUPPORT]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "1.7.7",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.FRAMELESS_DESKTOP_APP]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "1.8.0",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.LOCAL_FILE_SYNC]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "2.0.0",
      Windows: "25.8.28",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.LOCAL_LOG_FILE]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "25.5.23",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.SERVE_RESPONSE_WITHOUT_REQUEST_FOR_LOCAL_FILE]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "25.5.19",
      Windows: null,
      Linux: null,
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.EXTENSION_STATUS_NOTIFICATION]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "25.5.18",
  },
  [FEATURES.LOCAL_WORKSPACE_REFRESH]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "25.6.5",
      Windows: null,
      Linux: null,
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },

  [FEATURES.COMPATIBLE_DESKTOP_APP]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "25.5.20",
      Windows: "25.6.25",
      Linux: "1.4.20",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },

  [FEATURES.NON_BREAKING_DESKTOP_APP]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: {
      macOS: "25.5.20",
      Windows: "25.6.25",
      Linux: "1.4.20",
    },
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: null,
  },
  [FEATURES.API_CLIENT_INCLUDE_CREDENTIALS]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "25.6.10",
  },
  [FEATURES.REQUEST_RULE_GRAPHQL_PAYLOAD]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.6.29",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "25.6.29",
  },
  [FEATURES.API_CLIENT_MULTIPART_FORM]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.8.5",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "0.0.0",
  },
  [FEATURES.POPUP_CONFIG]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: null,
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "25.8.20",
  },
  [FEATURES.GRAPHQL_SUPPORT]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.8.20",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "0.0.0",
  },
  [FEATURES.LOCAL_FIRST_DESKTOP_APP]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.8.28",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "0.0.0",
  },
  [FEATURES.LOCAL_WORKSPACE_COMPATIBILITY]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.10.8",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "0.0.0",
  },
  [FEATURES.API_CLIENT_DESCRIPTION_COMPATIBILITY]: {
    [GLOBAL_CONSTANTS.APP_MODES.DESKTOP]: "25.12.5",
    [GLOBAL_CONSTANTS.APP_MODES.EXTENSION]: "0.0.0",
  },
};
